If this were LotR, I would attribute the translation to the power of the ring
Bilbo is wearing, but as of the time Tolkien wrote The Hobbit I think Tolkien
just ignored the issue of Elvish, and had everyone speaking the same
language. I suppose another possibility is that Bilbo is a quick
study. He has been in the Elvenking's fortress for a few weeks, and in
LotR we learn that he has some facility with Elvish languages. Perhaps
this was the beginning of his
studies!
“I dislike Allegory - the conscious and intentional allegory - yet any attempt to explain the purport of myth or fairytale must use allegorical language. (And, of course, the more 'life' a story has the more readily will it be susceptible of allegorical interpretations: while the better a deliberate allegory is made the more nearly will it be acceptable just as a story.)” (From Tolkien Letter # 131.)