A relaxation result for a class of degenerate Hamilton-Jacobi equations