If its all booked through i.e. your checked in on the fin air flight and your baggage is taken from your domestic flight to the finnair plane, then 5 hours should be more than enough.
IF you have booked the fights seperatly, I'd recommend hurrying along once you arrive at JFK tho 5 hours should be plenty of time to grab your bags and re-check-in for the trip to Finland.
If its all booked through