Finding a local Hamiltonian H[over ^] that has a given many-body wave function |ψ⟩ as its ground state, i.e., a parent Hamiltonian, is a challenge of fundamental importance in quantum technologies. Here we introduce a numerical method, inspired by quantum annealing, that efficiently performs this task through an artificial inverse dynamics: a slow deformation of the states |ψ(λ(t))⟩, starting from a simple state |ψ_{0}⟩ with a known H[over ^]_{0}, generates an adiabatic evolution of the corresponding Hamiltonian. We name this approach inverse quantum annealing. The method, implemented through a projection onto a set of local operators, only requires the knowledge of local expectation values, and, for long annealing times, leads to an approximate parent Hamiltonian whose degree of locality depends on the correlations built up by the states |ψ(λ)⟩. We illustrate the method on two paradigmatic models: the Kitaev fermionic chain and a quantum Ising chain in longitudinal and transverse fields.