  The equivalence between Chern-Simons and Einstein-Hilbert actions in three
dimensions established by A.~Ach\'ucarro and P.~K.~Townsend (1986) and
E.~Witten (1988) is generalized to the off-shell case. The technique is also
generalized to the Yang-Mills action in four dimensions displaying de Sitter
gauge symmetry. It is shown that, in both cases, we can directly identify a
gravity action while the gauge symmetry can generate spacetime local isometries
as well as diffeomorphisms. The price we pay for working in an off-shell
scenario is that specific geometric constraints are needed. These constraints
can be identified with foliations of spacetime. The special case of spacelike
leafs evolving in time is studied. Finally, the whole set up is analyzed under
fiber bundle theory. In this analysis we show that a traditional gauge theory,
where the gauge field does not influence in spacetime dynamics, can be (for
specific cases) consistently mapped into a gravity theory in the first order
formalism.
