1. You can look at the is_similar method for matrices, see this page for the documentation and examples.
2. You can get the transformation matrix A by setting the transformation parameter to True. Note that, since you are working with integer matrices, the transformation matrix will be in the algebraic field QQbar, you can get it back to ZZ as follows:
sage: A = X.is_similar(Y, transformation=True)[1].change_ring(ZZ)