Most likely, Dumbledore learned about it from Ron and Hermione. They obviously told him all they knew about what had happened, and I'm sure he'd have asked about what happened to Neville once he learned that something had happened to him.
Hermione, especially in the early years, is extremely honest. When asked a direct question from a teacher, let alone Dumbledore, it's unlikely she could lie (when the fate of the world isn't at stake).
Ron would most likely have been less forthcoming, but by and large both of them would have been easy to get the truth out of.