You can modify the transformation so it generates also link and not only preview image. The link could point to some document with Media Gallery web part and could contain LibraryName as query string parameter.
For example:
~/GalleryDetail.aspx?libname=<%# Eval("LibraryName") %>
The Media Gallery web part would get the Library name and use it. You can use following macro in Library name attribute of Media Gallery web part: {%libname%}