Assuming $A$ and $B$ are square: $BA$ is invertible, so $B$ is invertible. Note that
$$
B^{-1}(BA)B= AB
$$
so $AB$ is similar to $BA$.
Per the clarification: it is well known that $A$ and $B$ will have the same non-zero eigenvalues, as explained in the other answer. What's more: $AB$ and $BA$ have the same rank, which means that $BA$ (a $5 \times 5$ matrix) has eigenvalue $0$ with algebraic and geometric multiplicity $2$.
We must exclude, however, the possibility that $BA$ is diagonalizable. Equivalently, we want to show that since $(AB - I)^2$ has a lower rank than $(AB - I)$, $(BA - I)^2$ has a lower rank than $(BA - I)$.
$AB$ has an eigenvector $x$ assoicated with $1$, and a generalized eigenvector $y$ satisfying $ABy = y + x$. Thus, we see that $BA$ has eigenvector $Bx$, since
$$
(BA)(Bx) = B(AB)x = Bx
$$
moreover, $BA$ has generalized eigenvector $By$ satisfying
$$
(BA)(By) = B(AB)y = B(y + x) = (By) + (Bx)
$$
Thus, $BA$ indeed fails to be diagonalizable. Thus, we know its Jordan form.