Here's how it happens:
* The dwarves are captured by the elves: The dwarves, under the leadership of Thorin Oakenshield, are captured by the elves of Mirkwood while on their journey to the Lonely Mountain.
* The Elf King is curious: The Elf King, Thranduil, is intrigued by the dwarves and their strange tale. He calls them to his hall and listens to their story.
* The dwarves tell their tale: The dwarves, although wary of the elves, explain their journey to reclaim their ancestral home and treasure from Smaug the dragon.
* The Elf King overhears: While the dwarves speak, the Elf King is eavesdropping, hidden from view, but listening carefully to their words.
Therefore, the Elf King learns about the dwarves' adventure through overhearing their conversation, not through direct communication with them.