Yes you can charge up a battery with a 12V based UPS....mostly those with 500 watt rating operate on single battery and can charge...,,,offcoarse the charging current would be low....not compareable to Alternator or commercial battery charger.....(mind u: dont connect it with 24V based UPS...even in series with another battery.....the other battery will damage)
but in case of nearly dead batteries....this solution wont be effective...........the battrey will try to loose its potential even if the UPS charges it to lets say 13.4V-14V. Obviously batteries fall down to 12.6 V or so when charging stops at higher threshold....but not the dead ones....they keep on falling and loosing potential....
My suggestion,.....charge it through an electrician shop.....use it,,,,,and then dispose it off afterwards(if the solution works and battery provieds u some good startups).....otherwise go for a new 1,,,,,
i am sorry if i am going to offend sm1 ......but please dont post figures which ur not sure abt.......e.g. the post that says 5-7V charge difference.........even though he was right technically....coz dead battery falls in b/w 7-9V after the charger shutsoff at 14V......but to a general observer and even to me.....at first it sounded ODD....i mean what good is a battery charger or even a UPS charging ckt if it cant charge to 12V....