Some can, but only where law permits. Section 117 of the Criminal Procedure Code permits compromise in Schedule 3 and Schedule 4 offences and contains additional rules for certain specified matters.
The parties' private agreement cannot make every serious offence legally disappear.