Create a dynamic gallery of videos and images from a dataset

Hi, I would like to know if there is a way to create a dynamic gallery of videos and images starting from a dataset. In the dataset there is a “Photo & Video” field of the “Gallery / media” type where there is a mix of images and videos for each row

I am attaching an image to help you understand the problem better.
Thanks