Not from an episode. it's from this infomercial thingy: [yt]https://www.youtube.com/watch?v=ZVHm02FeCH8[/yt] Check out the 5:15 mark Question is, how did someone get a high quality gif of this? I've only seen it on this blurry video before.
It's from the Boole and Babbage infomercial that TrekCore did a write-up on a while ago. That exact GIF in on this page: http://trekcore.com/blog/2013/10/exclusive-inside-boole-babbages-trek-vision/
Could it be an outtake of a reaction shot? It looks like about one second in, he starts to lose his concentration, and stops being Riker to become Frakes. That final grin seems to be looking straight into the camera rather than at someone offscreen. Oh, never mind. I spent too much time analyzing the zoom after post #2 while the other posts came in.