Yes.

Make square matrix $O$ with entries variables. We have $O'=O^{-1}$
and $O'$ is the transpose.

Mulitply both RHSs by $O'$. Since $OO'=I$ we get:

$O'A=CO',O'B=DO'$.

These are systems of linear equations over $K$ and are efficiently
solvable.