Relation between Nambu and Hamiltonian mechanics