「の」is often used In colloquialism and expressions of feeling,like「見る」,「聞く」,「感じる」....for example,「太郎が英語で話しているのを聞いた」
「こと」mainly used for wrriten words and objective expressions,for example,「社长はA社との取引を行うことに决めた」
There seems some differences in tone..
「芝生に入ることを禁じる」=keep off the grass
「芝生に入るのはダメよ」=hey,plz don‘t get into the grass