I would never do this for many reasons, but first you would need some high density foam ( preferably 1/2" ), then you obviously need the vinyl, cut the foam into patterns ( where all the flat spots start to curve and you want the patterns to be roughly 1/8" apart from each other ) then you need to cut the vinyl 1/2" larger then the foam patterns, you then need to glue the vinyl to the foam ( do not use spray adhesive from the can it just won't hold, use contact cement from an upholstery supplier and a cheap $20 cup gun from harbor freight ) then you sew the patterns together, now you have to figure out how you want to attach it to the floor, you can spray the contact cement to attach it to the floor which would be a nightmare if you ever had to remove it, so I would glue that cheap carpet you use for speaker boxes or for trunks ( called stretch carpet ) to the back of the foam and get a roll of Velcro from home depot and clean your floor really good and prep it with rubbing alcohol then only use the stiff side of the Velcro and stick several pieces to the floor and stick your vinyl floor to that this way it can be easily remove for whatever reason you need, and trust me this Velcro sticks good so no worries on it shifting.
cutting your patterns and sewing them together correctly is the most important, otherwise you will never get the vinyl to lay in on the contours without having a ton of wrinkles and bunching.
this is just one way to do it.