Let $A$ and $B$ be two matrices over $\mathbb Q[x]$. What is the relation be the the conditions that (1) $\det(xI-A) = \det (xI-B)$ and that (2) $A$ and $B$ are equivalent, that is, there exists invertible matrices $P$ and $Q$ over $\mathbb Q[x]$ such that $A = PBQ$.
Do these two conditions imply each other? If so, what is a proof? If one does not imply the other, why not?