I know that the work needed to move a charge $q$ from a point A to a point B in presence of a steady electric field $\vec{E}$ is
$P = \displaystyle\frac{dW}{dt} = \displaystyle\frac{d}{dt}\left(q\int_C \vec{E}\cdot d\vec{l}\right) = \displaystyle\frac{dq}{dt}\int_C \vec{E}\cdot d\vec{l} = IV$
However, I have read that this is only true when the cross-section of the conductor is constant. Otherwise, the right formula should be
$P = \displaystyle\iiint_V\vec{E}\cdot\vec{J} dV$,
where $\vec{J}$ is the current density that flows throught the conductor cross-section.
Why is the first equation only valid for constant cross-section conductors?
Thank you.