It seems Khatovar has answered this before:

http://www.dual-boxing.com/showthread.php?t=27315

/run LFGTeleport(IsInLFGDungeon())

The IsInLFGDungeon() detects if you're in a dungeon, duh!, then passes that to the teleport function. So it's a one-button teleport in or out of dungeon macro.