It seems to be ok, but please have a look to "BKE_mesh_to_bmesh" (line 47) and "BKE_bmesh_to_mesh" (line 51), because I'm not sure to give them the good parameters.
There were some issues, which I fixed myself. Thanks for your contribution!
This #include is no longer necessary.
Keep the #includes grouped, so add DNA_xxx files to the already-existing #include "DNA_xxx" statements.
The DM_to_bmesh call also calculated normals, which your code does not.