The aim of the present work is twofold: first, we show how all the
n-dimensional Riemannian and Lorentzian metrics can be constructed from a
certain class of systems of second-order PDE's which are in duality to the
Hamilton-Jacobi equation and second we impose the Einstein equations to these
PDE's