The second avoids using a proposition as the last word in the sentence, and although this is supposed to be better, it is fairly commonly known that this idea (that one should not end a sentence in a preposition) was based on Latin (where this does not happen), and hence, is not considered an absolute necessity.