What is the purpose of these extra 'level shifter' BJTs on a MOSFET H-Bridge?
In order to turn off, a MOSFET must have a \$V_{gs}\$ which is less than some threshold. Ideally it should be 0. 

For the lower transistors (the NMOS ones), this is fairly easy to understand - the source is connected to ground, so the \$V_{gs}\$ is calculated simply as equal to the voltage applied to the gate. If you have say a 5V MCU, this would be either 5V (on) or 0V (off).

For the upper transistor (the PMOS ones), it is a bit more confusing. The PMOS transistors have a \$V_{gs}\$ which is negative to be turned on. To turn on the gate must be at a lower potential than the source. To turn off, the gate must be at a potential close enough to the source to be less than a threshold.

Because the source of the PMOS is tied to 12V in the first circuit, its gate must be around 12V in order to turn off. If you drive the gate with a \$5V\$ signal directly, its gate is going to be \$V_{gs} = V_{io} - V_{sup} = 5 - 12 = -7V\$. If you drive it with a \$0V\$ signal, then \$V_{gs} = V_{io} - V_{sup} = 0 - 12 = -12V\$. If you consider that the threshold would be somewhere in the region of \$-1.5V\$, clearly the PMOS would be on in both cases - you could never turn it off.

To get around this, a level shifter must be added such that the gate is driven with either \$12V\$ (off) or \$0V\$ (on). The BJT in the circuit acts as a level shifter to convert the 5V control signal into the required 12V signal for the gate of the PMOS.

However, there is a side effect of the BJT circuit used which is that it inverts the control signal - a 0 becomes \$12V\$ (off) and a 1 becomes \$0V\$ (on). As a result the control signals have to be connected diagonally because you never want both transistors on the same half-bridge to be on at the same time - otherwise you short out the power supply.



In your latter circuit your motor supply and control signals are at the same level which means a level shifter is not needed - the 5V control signal can turn off the PMOS because it can create \$V_{gs} = V_{io} - V_{sup} = 5 - 5 = 0V\$. Because you no longer have the inverting level shifter, the MOSFETs are connected so that both transistors in the same half-bridge have the same control signal. A 0 now turns on the PMOS but turns off the NMOS, and a 1 turns on the NMOS but turns off the PMOS. This ensures both transistors in the same half-bridge never turn on at the same time.