All DTOs cannot be built from database.
But if you mean domain object or entity objects, yes, Hibernate has a tool(Search for it in google).
You can use domain objects as DTOs and inside DTOs.
For the projects that need high reusablity at the domain objects, it is bad practice to produce objects from database. You need to design your domain objects and then map them to a persistence tier if you need to persist them.
But if you have a big legacy system it could be a good approach.