The Jacobian conjecture in dimension $n$ asserts that any polynomial endomorphism of $n$-dimensional affine space over a field of zero characteristic, with the Jacobian equal 1, is invertible. The Dixmier conjecture in rank $n$ asserts that any endomorphism of the $n$-th Weyl algebra (the algebra of polynomial differential operators in $n$ variables) is invertible. We prove that the Jacobian conjecture in dimension $2n$ implies the Dixmier conjecture in rank $n$. Together with a well-known implication in the opposite direction, it shows that the stable Jacobian and Dixmier conjectures are equivalent. The main tool of the proof is the reduction to finite characteristic. After the paper was finished we have learned that the main result was already published by Y.Tsuchimoto in Osaka Journal of Mathematics Volume 42, Number 2 (June 2005). His proof is different.