Warning The type of carrier pictured in the question may not be the optimal choice for pet protection during an accident. The following answer is specific to the type of carrier in the question.
After some research it appears there is only one group testing pet carriers in accidents. Center for Pet Safety this is a non-profit who received funding from Subaru. There are no standards or regulation and the level of testing is nowhere near as complete as human crash testing.
The current level of testing is not about the pets survival but about the crates. Many of the crates tested, broke during testing. With crash dummy pets being fully or partially ejected.
Of the two positions for carriers in the question, the side to side seems to offer more protection. Pets impacting the carrier door during an accident tended to be ejected. Additionally carriers that were not held tightly to the seat seemed to suffer more damage, so using the seat belt tends to offer more protection.
The carriers pictured in the question are popular due to their relatively low cost and ease of cleaning. There are several different manufactures of this type of carrier, not all have been tested and there are various results from those tested, some test pets were ejected through the side of this type of carrier!
Of the two choices in the question, side to side, secured with the seat belt is better. But may not be the best possible solution. There are many variables, including the size of the pet. There is insufficient information at this time for conclusion about injuries based on the pets positioning inside carrier, that are not ejected. A more complete summery is available here (2015 PDF)