You can eat and drink in some trains!
Shinkansen is OK.
Romance Car is OK.
Basically, you can eat and drink sitting in box seats, but there are some exception ; Yurikamome is not suitable.
Commuter trains are not suitable.
When you find a vendor selling Obento by a cargo in train, definitely you can eat there.
You need to throw it to garbage.