All headed constituency-based structures (i.e. endocentric structures) can be easily translated to the corresponding dependency-based structures. One need merely collapse all the projections (minimal, intermediate, and maximal) of a word down to one node.
A non-headed constituency-based structure (i.e. it has exocentric structures), however, cannot be translated to a dependency-based structure, because dependency by its very nature views all syntactic structures as headed (i.e. endocentric). See the distinction between endocentric and exocentric structures here: https://en.wikipedia.org/wiki/Endocentric.
All dependency-based structures can also easily be automatically translated into corresponding constituency-based structures. But here's the difference: the constituency-based structures that result from the translation are necessarily quite flat, much flatter than most constituency-based grammars want to assume. Above all, the resulting flat structures do not acknowledge a finite VP constituent. Without the finite VP constituent, there is no way to do much of standard Chomskyan syntax. For instance, all explanations of syntactic phenomena that build on c-command are not possible without the finite VP constituent.
The distinction between dependency and constituency is quite profound. Dependency is a strict one-to-one ratio (words to nodes), whereas constituency is a one-to-one-or-more ratio (words to nodes). If one operates with a dependency-based model, the amount of syntactic structure that one can posit is very limited. Whereas if one is operating with a constituency-based model, one has the ability to assume much more layered (i.e. taller) syntactic structures. One has the ability to acknowledge many more groupings of words (i.e. constituents) in the constituency-based model.
As an experiment, count the number of nodes and edges in the two trees in the question. The dependency-based tree contains 7 words and 7 nodes with 6 edges. The constituency tree, in contrast, has 13 nodes and 12 edges. These numbers bear witness to drastically different ways to approach the syntax of natural language. Dependency-based models are minimal, whereas constituency-based models are maximal.
The pertinent question is whether the extra structure that constituency enables is warranted. My personal view is that it is not, but each grammarian has to make up his or her own mind about that.