You can't really do this precisely unless the meshes are topologically identical. You can do a decent, but not perfect job with something like this:
- for each triangle in the source model, derive a tangent space matrix. That's the matrix which converts the world space points of that triangle into the UV points of that face.
- for each triangle in the target model, see if it matches one of the triangles in the source. "Match" will mean "has the same three corners" regardless of order (assuming you can fix up your normals in a separate step
- Where source triangles have exact matches in the target triangles, apply a planar project that matches the tangent space matrix.
- where a target triangle doesn't have an exact match you'll have to guess; you can try finding the N closest matches and doing a weighted blend between all of their matrices or something like that - but it will be hacky
- This should be visually pretty close to the source, but all of the UV triangles will be disconnected; you'll need to merge coincident UVs to prevent seams.
It's a pretty non-trivial project, unfortunately.