Why is the first bar a whole step? To me, it seems like both the first and second bar would be half steps since both notes are as close as possible to each other without them being in the same height position.
It's entirely logical of you to think that the musical stave would work like a graph of notes evenly spaced by semitone, with each position a semitone apart (this being the smallest interval normally considered in Western music).
However, standard musical notation doesn't work like this. Instead, standard notation shows a graph only of the notes in the C major scale (i.e. the white keys on the keyboard)*.
In your picture, the first interval is between A and B, which is a gap of two half steps. The second interval is from E to F, which is one half step. If you want to know why the major scale is like this, with these uneven gaps, then The major scale - why and how? and other questions on this site might be interesting.
Why is music theory built so tightly around the C Major scale? might also explain why, in turn, that scale is taken as the basis of the most common Western notation system.
However, all of this is only one way of representing music. There are other ways that work differently - if you google for 'chromatic staff', 'chromatic stave', or 'chromatic notation', you'll find systems of notation that represent notes more evenly, as you expected (though these are much less commonly-used than standard notation).
*these notes can then be altered by key signatures and accidentals to facilitate different keys and notes outside of the key.
Using the note names A>G, (7 names), and having 12 separate notes (including #and b), things are not straightforward. Looking at a piano keyboard will help it make sense. Each white key has a letter name; the blacks are #/b. So, starting at A, which is just to the right of the middle of the three blacks, the whites go up sequentially. That means that next note to the right (white) is B, as shown in your stave. Because there is another note between them, it's a tone - a whole step.
Going backwards to the E>F in your second stave, you'll see that there's no black between, so it's a semitone - or half-step. There are only two half-steps in music - between B and C, and your example, between E and F. All other dots on a line and the next space (and vice versa) will be a whole step - properly named 'tone'.
The notes on the stave do not indicate whole or half step intervals except when a sharp or flat sign is included. The answer to the question posted here is in the understanding of how different scales are constructed, major, minor, etc. The notes on the page only represent the notes of the scale in question. Look to the Key signature at the beginning of the piece for that information. If the key signature were to indicate the F to be Sharp or the E to be flat, the individual notes would appear on the stave in exactly the same relationship to each other but the interval between the tones would then be a whole step and the half step position would be moved accordingly.
Do yourself a favor and read about any basic text explaining standard staff notation. The notes in the first bar correspond to white keys on a keyboard with a black key between them, the notes in the second bar correspond to white keys on a keyboard without a black key between them.