Conservation of Newton's law 
Suppose $F$ is independent of velocity,so Newton's law can be
expressed as : $m \ddot{\mathbf{x}}(t)=\mathbf{F}(\mathbf{x}(t)) .$
Then an energy function of the form $$ E(\mathbf{x}, \dot{\mathbf{x}})=\frac{1}{2} m|\dot{\mathbf{x}}|^{2}+V(\mathbf{x}) $$
is conserved(i.e for any solution of Newton's equation $E$ is a
constant independent of $t$) if and only if $V$ satisfies $$-\nabla V=\mathbf{F}. $$

The proof is by calculating:
$$
\begin{aligned}
\frac{d}{d t}\left(\frac{1}{2} m|\dot{\mathbf{x}}(t)|^{2}+V(\mathbf{x}(t))\right) &=m \sum_{j=i}^{n} \dot{x}_{j}(t) \ddot{x}_{j}(t)+\sum_{j=1}^{n} \frac{\partial V}{\partial x_{j}} \dot{x}_{j}(t) \\
&=\dot{\mathbf{x}}(t) \cdot[m \ddot{\mathbf{x}}(t)+\nabla V] \\
&=\dot{\mathbf{x}}(t) \cdot[\mathbf{F}(\mathbf{x})+\nabla V(\mathbf{x})].
\end{aligned}
$$
The question here is if $
-\nabla V=\mathbf{F}
$ easy to see energy is conserved
but how to prove the "only if" part?
 A: You already have proved the "only if" part. What your derivation shows is that
$$\frac{d}{d t}\left(\frac{1}{2} m|\dot{\mathbf{x}}(t)|^{2}+V(\mathbf{x}(t))\right)$$
equals zero only if
$$\mathbf{F} = -\nabla V.$$
In other words, your work proves
$$\mathbf{F} = -\nabla V \implies \frac{d}{d t}\left(\frac{1}{2} m|\dot{\mathbf{x}}(t)|^{2}+V(\mathbf{x}(t))\right) = 0.$$
Now, for the other direction, start with the assumption that
$$\frac{d}{d t}\left(\frac{1}{2} m|\dot{\mathbf{x}}(t)|^{2}+V(\mathbf{x}(t))\right) = 0$$
and derive
$$\mathbf{F} = -\nabla V.$$
The derivation will look very similar to what you've already done.
A: Let look at this example one dimensional
Kinetic Energy is
$$T=\frac{m}{2}\,\dot{x}^2$$
and Potential Energy is
$$ U=U(x)$$
with Euler Lagrange you get
$$m\,\ddot{x}+\frac{\partial}{\partial x}\,U(x)=0$$
thus according to Newton second law
$$F=-\frac{\partial}{\partial x}\,U(x)$$
and the total energy
$$E=T+U(x)=~\text{constant}$$
but if the potential energy is :
$$U=U(x,t)$$
you obtain the equation of motion
$$m\,\ddot{x}+\frac{\partial}{\partial x}\,U(x,t)=0$$
and your force is
$$F=-\frac{\partial}{\partial x}\,U(x,t)$$
$$E=T+U(x,t)\ne ~\text{constant}$$
thus only if the potential energy is $U=U(x)~,\text{or}~,F=F(x)$  the total energy is constant
