$P={I}^{2}R$ and $P=\frac{{V}^{2}}{R}$ are basically the same relation. First one is usually used when I is constant and second one when V is constant.
Using $I=\frac{V}{R}$ one can be derived from the other.
$P={I}^{2}R={\left(\frac{V}{R}\right)}^{2}R={V}^{2}R$